lobsterlayui.main(['index', 'layer', 'form', 'element', 'table', 'tree'], {
    data: {
        $layui: null,
        otctable: null
    },
    pageload: function (right) {
        console.log(right);
        this.initevent();
        this.loadotc();
    },
    initevent() {
        var self = this;

        layui.form.on("submit(LAY-app-front-search)", function (data) {
            self.data.otctable.reload({
                where: {
                    drugname: $("#pdrugName").val(), //获取值
                },
                page: {
                    curr: 1
                }
            });
        });
    },
    loadotc: function () {
        var self = this;
        //表格绑定
        self.data.otctable = layui.table.render({
            elem: '#entlist',
            headers: lobsterlayui.GetHeaderData(),
            where: {
                drugname: $("#pdrugName").val()  //获取文本值
            },
            url:lobsterlayui.GetLowCodeUrl('tsotcdrug.getotcdrugs'),
            height: 'full-130',
            cellMinWidth: 80,
            size: 'sm',
            toolbar: '#toolbar',
            page: true,
            even: true,
            cols: [[
                { width: "15%", field: '药品名称', title: '药品名称', fixed: 'left' },
                { width: "40%", field: '药品规格', title: '药品规格' },
                { width: "15%", field: '药品类型', title: '药品类型', align: 'center' },
                { width: "15%", field: 'OTC类别', title: 'OTC类别', align: 'center' },
                { width: "15%", field: '备注', title: '备注' }
            ]],
            parseData: function (res) {
                return {
                    code: res.code,
                    msg: res.msg,
                    count: res.data.count,
                    data: res.data.list
                }
            }
        });
    },
})